import http from './http'
let root = ''
// root =  '/public/api/index.php/'
if (process.env.NODE_ENV === 'dev') {
	root =  '/public/api/index.php/'
}else{
	root = process.env.VUE_APP_BASE_URL + '/api/index.php/'
}
console.log('root',root);
export default {
	// /index/newsList 新闻列表
	newsList(params) {
		return http.fetchGet(root + "index/newsList.html",params)
	},
	// /login/doLoginByOpenId 通过open_id登录
	doLoginByOpenId(params) {
		return http.fetchPost4NoMsg(root + "login/doLoginByOpenId.html",params)
	},
	// /login/wechatGetOpenId /login/wechatGetOpenId
	getOpenid(params) {
		return http.fetchPost(root + "login/wechatGetOpenId.html",params)
	},
	// /index/wechatJs 获取微信js
	getWeixinConfig(params) {
		return http.fetchPost(root + "index/wechatJs.html",params)
	},
	// /units_policy/applyPolicyList 申请的政策列表
	applyPolicyList(params) {
		return http.fetchGet(root + "units_policy/applyPolicyList.html",params)
	},
	// /units_policy/applyPolicy 政策申请
	applyPolicy(params) {
		return http.fetchPost(root + "units_policy/applyPolicy.html",params)
	},
	// ​/units_policy​/getMatePolicyList 匹配政策列表
	getMatePolicyList(params) {
		return http.fetchPost(root + "units_policy/getMatePolicyList.html",params)
	},
	// /units_policy/matePolicy 政策匹配
	matePolicy(params) {
		return http.fetchPost4NoMsg(root + "units_policy/matePolicy.html",params)
	},
	// /member/saveMemberAvatar 修改头像
	saveMemberAvatar(params) {
		return http.fetchPost(root + "member/saveMemberAvatar.html",params)
	},
	// /member/updateMobile 修改手机号
	updateMobile(params) {
		return http.fetchPost(root + "member/updateMobile.html",params)
	},
	// /member/collectPolicyList 政策收藏列表
	collectPolicyList(params) {
		return http.fetchGet(root + "member/collectPolicyList.html",params)
	},
	// /member/getAllMember 获取用户全部信息
	getAllMember(params) {
		return http.fetchGet(root + "member/getAllMember.html",params)
	},
	// /member/getMemberConfig 获取会员完善信息的配置项
	getMemberConfig(params) {
		return http.fetchGet(root + "member/getMemberConfig.html",params)
	},
	// /member/analysisCardNo 解析身份证号
	analysisCardNo(params) {
		return http.fetchGet(root + "member/analysisCardNo.html",params)
	},
	// Common/upImg 头像上传
	upImg(params) {
		return http.fetchPostForUpload(root + "Common/upImg.html",params)
	},
	// /login/outLogin 退出登录
	outLogin(params) {
		return http.fetchGet(root + "login/outLogin.html",params)
	},
	// /member/getInputMemberFields 获取表单设置信息
	getInputMemberFields(params) {
		return http.fetchGet(root + "member/getInputMemberFields.html",params)
	},
	// /member​/getInputMemberFieldsByView 获取表单预览设置信息
	getInputMemberFieldsByView(params) {
		return http.fetchGetNotToken(root + "member/getInputMemberFieldsByView.html",params)
	},
	// /member/saveMemberInfo 保存用户信息
	saveMemberInfo(params) {
		return http.fetchPost(root + "member/saveMemberInfo.html",params)
	},
	// /member/getMember 获取用户信息
	getMember(params) {
		return http.fetchGet(root + "member/getMember.html",params)
	},
	// ​/units_policy​/cancelCollect 取消收藏政策
	cancelCollect(params) {
		return http.fetchPost(root + "units_policy/cancelCollect.html",params)
	},
	// /units_policy/collect 收藏政策
	collect(params) {
		return http.fetchPost(root + "units_policy/collect.html",params)
	},
	// /units_policy/details 获取政策详情
	getDetails(params) {
		return http.fetchGet(root + "units_policy/details.html",params)
	},
	// 获取最新申请 /units_policy/latestApply
	latestApply(params) {
		return http.fetchGet(root + "units_policy/latestApply.html",params)
	},
	// 获取检索关键词 /units_policy/getKeywords
	getKeywords(params) {
		return http.fetchGet(root + "units_policy/getKeywords.html",params)
	},
	// /units_policy/unitsPolicyList 政策列表
	unitsPolicyList(params) {
		return http.fetchGet(root + "units_policy/unitsPolicyList.html",params)
	},
	//登录 start
	apiLogin(params) {
		return http.fetchPost4login(root + "login/doLoginByCode.html", params)
		// return http.fetchPost(root + "login/doLogin.html", params)
	},
	// 发送短信验证码 /login/sendCode
	apiSendCode(params) {
		return http.fetchPost(root + "login/sendCode.html", params)
	},
	vLogin() {
		return http.fetchGet(root + "login/vLogin.html")
	},

	getCaptcha(cache){
		return process.env.VUE_APP_BASE_URL + "/api/index.php/login/Captcha.html"+"?img_cache=" + cache;
	},

	//图片上传
	uploadImg(params){
		return http.fetchPostForUpload(root + "Common/upImg.html",params);
	},


	//图片上传
	jsErrorLog(params){
		return http.fetchPost(root + "Common/jsErrorLog.html",params);
	},
}